package com.centaline.androidsalesblog.api;

import com.centaline.androidsalesblog.constants.CommonConstant;
import com.centaline.androidsalesblog.model.businissobject.WxAuthBo;
import com.centanet.framework.interfaces.IResponseListener;

/**
 * 微信授权获取access_token
 * Created by guilin on 16/4/11.
 */
public class WxAuthApi extends WxOpenApi<WxAuthBo> {

    private String code;

    public WxAuthApi(Class<?> tag, Class<WxAuthBo> aClass, IResponseListener<WxAuthBo> iResponseListener) {
        super(tag, aClass, iResponseListener);
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    protected void setParams() {
        putStringParams("appid", CommonConstant.APP_ID_WX);
        putStringParams("secret", CommonConstant.APP_SECRET_WX);
        putStringParams("code", code);
        putParams("grant_type", "authorization_code");
    }

    @Override
    protected String getPath() {
        return "oauth2/access_token";
    }
}
